Skip to content

Conversation

@chrstph-dvx
Copy link
Contributor

@chrstph-dvx chrstph-dvx commented Feb 3, 2024

Summary

We can now generate one token list rather than multiple one for each network.
For each token on a given chain, we add information on which chain this token can be bridged from and to.

For example, given the input:

{
  "chainId": 1,
  "name": "Arbitrum",
  "address": "0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1",
  "symbol": "ARB",
  "decimals": 18,
  "logoURI": "https://arbitrum.foundation/logo.png",
}

We have as a result:

{
  "...": "...",
  "tokens": [
    {
      "address": "0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1",
      "chainId": 1,
      "extensions": {
        "bridgeInfo": {
          "42161": {
            "tokenAddress": "0x912CE59144191C1204E64559FE8253a0e49E6548",
            "...": "..."
          },
          "42170": {
            "tokenAddress": "0xf823C3cD3CeBE0a1fA952ba88Dc9EEf8e0Bf46AD",
            "...": "..."
          },
          "1380012617": {
            "tokenAddress": "0xC6bB9Ff34E246302C047BF8b494Fe723c2A7E59f",
            "...": "..."
          }
        }
      }
    },
    {
      "chainId": 42161,
      "address": "0x912CE59144191C1204E64559FE8253a0e49E6548",
      "extensions": {
        "bridgeInfo": {
          "1": {
            "tokenAddress": "0xb50721bcf8d664c30412cfbc6cf7a15145234ad1",
            "...": "..."
          },
          "1380012617": {
            "tokenAddress": "0xC6bB9Ff34E246302C047BF8b494Fe723c2A7E59f",
            "...": "..."
          }
        }
      }
    },
    {
      "chainId": 42170,
      "address": "0xf823C3cD3CeBE0a1fA952ba88Dc9EEf8e0Bf46AD",
      "name": "Arbitrum",
      "symbol": "ARB",
      "decimals": 18,
      "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
      "extensions": {
        "bridgeInfo": {
          "1": {
            "tokenAddress": "0xb50721bcf8d664c30412cfbc6cf7a15145234ad1",
            "...": "..."
          }
        }
      }
    },
    {
      "chainId": 1380012617,
      "address": "0xC6bB9Ff34E246302C047BF8b494Fe723c2A7E59f",
      "name": "Arbitrum",
      "symbol": "ARB",
      "decimals": 18,
      "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
      "extensions": {
        "bridgeInfo": {
          "1": {
            "tokenAddress": "0xb50721bcf8d664c30412cfbc6cf7a15145234ad1",
            "...": "..."
          },
          "42161": {
            "tokenAddress": "0x912ce59144191c1204e64559fe8253a0e49e6548",
            "...": "..."
          }
        }
      }
    }
  ]
}

From a Bridge UI point of view, this enable us to store tokens by a tuple (chain id, address on the chain) rather than storing everything by L1 address which causes issues for some tokens (USDC for example)

@chrstph-dvx chrstph-dvx self-assigned this Feb 3, 2024
@chrstph-dvx chrstph-dvx changed the title Allow l2Network as an explicit parameter feat: Enable cross-chain token lists Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants